package cc.atliberty.creating.simplefactory.simplefactory2;

import cc.atliberty.creating.simplefactory.simplefactory1.Grape;
import cc.atliberty.creating.simplefactory.simplefactory1.IFruit;
import cc.atliberty.creating.simplefactory.simplefactory1.Strawberry;

/**
 * 简单工厂
 */
public class FruitGarden {
    
    public static IFruit factory(String which) {
        IFruit fruit = null;
        if (which.equalsIgnoreCase("grape")) {
            return new Grape();
        } 
        if (which.equalsIgnoreCase("strawberry")) {
            return new Strawberry();
        }
        return null;
    }
}
